Skip to content

fix: harden proxy and error handling against abuse - #365

Merged
cebarks merged 1 commit into
mainfrom
request-safety
Jul 30, 2026
Merged

fix: harden proxy and error handling against abuse#365
cebarks merged 1 commit into
mainfrom
request-safety

Conversation

@cebarks

@cebarks cebarks commented Jul 29, 2026

Copy link
Copy Markdown
Owner

Summary

  • Cap zlib decompression output to prevent zip-bomb DoS (64 MB in proxy, 16 MB in raid tracker) using Read::take()
  • Add proxy-specific 16 MB body size limit, tighter than the global 64 MB PayloadConfig
  • Return JSON error responses for API clients that send Accept: application/json while preserving HTML for HTMX requests (detected via HX-Request header)

Test plan

  • Existing proxy rewrite tests pass (including new rewrite_caps_decompressed_output)
  • All 816 tests pass
  • Zero clippy warnings
  • Verify JSON error responses with curl -H 'Accept: application/json' /quma/api/...
  • Verify HTMX partials still return HTML fragments

Implemented with the help of Claude Code

Cap zlib decompression output (64 MB proxy, 16 MB raid tracker) to
prevent zip-bomb DoS. Add proxy-specific 16 MB body limit tighter than
the global 64 MB PayloadConfig. Return JSON error responses for API
clients that send Accept: application/json (HTMX requests still get
HTML via HX-Request header detection).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@cebarks
cebarks merged commit 4d5ccff into main Jul 30, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant